import store from '@/store'
window.buttonPermission=function(key) {
  var url=window.location.hash.replace("#/","").split('/'),
      first="/"+url[0],
      two=url[1]+"/"+url[2],
      rolesList=store.getters.menuList,
      hasBool=false;
  rolesList.some((val0)=>{
  	if(val0.menuName){
  	 	hasBool= true;
        return true;
    }else{
      	val0.some((val)=>{
            if(val.menuUrl==first&&!hasBool){
		     	val.childrenMenuList.some((val1)=>{
		     		if(val1.routeUrl==two&&!hasBool){
		     			val1.menuPermissionList.some((val2)=>{
		                    if(val2.permissionKey==key){
		                    	hasBool= true;
		                    	return true;
		                    }
		     			})
		     		}
		     	})
		    }
      	})
      }
  });
  return hasBool;
}